webpackJsonp([1],{

/***/ 221:
/***/ (function(module, exports, __webpack_require__) {

var disposed = false
function injectStyle (ssrContext) {
  if (disposed) return
  __webpack_require__(238)
}
var normalizeComponent = __webpack_require__(20)
/* script */
var __vue_script__ = __webpack_require__(240)
/* template */
var __vue_template__ = __webpack_require__(241)
/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = null
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  __vue_script__,
  __vue_template__,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)
Component.options.__file = "resources\\assets\\js\\components\\admin\\sys_setting\\setting_site.vue"

/* hot reload */
if (false) {(function () {
  var hotAPI = require("vue-loader/node_modules/vue-hot-reload-api")
  hotAPI.install(require("vue"), false)
  if (!hotAPI.compatible) return
  module.hot.accept()
  if (!module.hot.data) {
    hotAPI.createRecord("data-v-5a9376d0", Component.options)
  } else {
    hotAPI.reload("data-v-5a9376d0", Component.options)
  }
  module.hot.dispose(function (data) {
    disposed = true
  })
})()}

module.exports = Component.exports


/***/ }),

/***/ 238:
/***/ (function(module, exports, __webpack_require__) {

// style-loader: Adds some css to the DOM by adding a <style> tag

// load the styles
var content = __webpack_require__(239);
if(typeof content === 'string') content = [[module.i, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var update = __webpack_require__(19)("11c0bf06", content, false, {});
// Hot Module Replacement
if(false) {
 // When the styles change, update the <style> tags
 if(!content.locals) {
   module.hot.accept("!!../../../../../../node_modules/_css-loader@0.28.11@css-loader/index.js!../../../../../../node_modules/_vue-loader@13.7.1@vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-5a9376d0\",\"scoped\":false,\"hasInlineConfig\":true}!../../../../../../node_modules/_vue-loader@13.7.1@vue-loader/lib/selector.js?type=styles&index=0!./setting_site.vue", function() {
     var newContent = require("!!../../../../../../node_modules/_css-loader@0.28.11@css-loader/index.js!../../../../../../node_modules/_vue-loader@13.7.1@vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-5a9376d0\",\"scoped\":false,\"hasInlineConfig\":true}!../../../../../../node_modules/_vue-loader@13.7.1@vue-loader/lib/selector.js?type=styles&index=0!./setting_site.vue");
     if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
     update(newContent);
   });
 }
 // When the module is disposed, remove the <style> tags
 module.hot.dispose(function() { update(); });
}

/***/ }),

/***/ 239:
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(14)(false);
// imports


// module
exports.push([module.i, "\n.avatar-uploader .el-upload {\n    border: 1px dashed #d9d9d9;\n    border-radius: 6px;\n    cursor: pointer;\n    position: relative;\n    overflow: hidden;\n}\n.avatar-uploader .el-upload:hover {\n    border-color: #409EFF;\n}\n.avatar-uploader-icon {\n    font-size: 28px;\n    color: #8c939d;\n    width: 178px;\n    height: 178px;\n    line-height: 178px;\n    text-align: center;\n}\n.avatar {\n    width: 178px;\n    height: 178px;\n    display: block;\n}\n", ""]);

// exports


/***/ }),

/***/ 240:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

/* harmony default export */ __webpack_exports__["default"] = ({
    data: function data() {
        return {
            hint: {
                title: '操作提示',
                content: '网站全局设置，基本配置'
            },
            title: 'web_set',
            ruleForm: {
                name: '',
                caseNumber: '',
                linkman: '',
                tel: '',
                address: '',
                openDown: true,
                downDesc: ''
            },
            imageUrl: '',
            path: '',
            csrf_token: { _token: $('meta[name="csrf-token"]').attr('content') },
            rules: {
                name: [{ required: true, message: '请输入网站名称', trigger: 'blur' }]
                // openDown: [{ required: true, message: '请选择网站开关' }],
                // downDesc: [{ required: true, message: '请输网站关闭时文字显示', trigger: 'blur'}],
            }
        };
    },
    created: function created() {
        this.getWebSet();
    },

    methods: {
        submitForm: function submitForm(formName) {
            var _this = this;

            this.$refs[formName].validate(function (valid) {
                if (valid) {
                    if (_this.ruleForm.openDown === false) {
                        if (_this.ruleForm.downDesc === '') {
                            _this.$message('关闭网站请填写文字显示');
                            return false;
                        }
                        _this.saveWebSet();
                    } else {
                        _this.saveWebSet();
                    }
                } else {
                    console.log('error submit!!');
                    return false;
                }
            });
        },
        getWebSet: function getWebSet() {
            var _this2 = this;

            axios.post(this.adminApi('/config-page'), {
                'title': this.title
            }).then(function (res) {
                if (res.data.code === 0) {
                    // this.$message.success(res.data.msg)
                    _this2.ruleForm.name = res.data.info.webName;
                    _this2.imageUrl = res.data.info.logoPath;
                    _this2.ruleForm.caseNumber = res.data.info.caseNumber;
                    _this2.ruleForm.linkman = res.data.info.linkman;
                    _this2.ruleForm.tel = res.data.info.tel;
                    _this2.ruleForm.address = res.data.info.address;
                    res.data.info.openDown === 1 ? _this2.ruleForm.openDown = true : _this2.ruleForm.openDown = false;
                    _this2.ruleForm.downDesc = res.data.info.downDesc;
                } else {
                    _this2.$message.error(res.data.msg);
                }
            }).catch(function (res) {
                _this2.$message.error('请稍后重试1！');
            });
        },

        //保存网站基本设置
        saveWebSet: function saveWebSet() {
            var _this3 = this;

            var img_path = '';
            if (this.path) {
                img_path = this.path;
            } else {
                img_path = this.imageUrl;
            }
            axios.post(this.adminApi('/web-set'), {
                title: this.title,
                name: this.ruleForm.name,
                path: img_path,
                caseNumber: this.ruleForm.caseNumber,
                linkman: this.ruleForm.linkman,
                tel: this.ruleForm.tel,
                address: this.ruleForm.address,
                openDown: this.ruleForm.openDown ? 1 : 0,
                downDesc: this.ruleForm.downDesc
            }).then(function (res) {
                if (res.data.code === 0) {
                    _this3.$message.success(res.data.msg);
                    _this3.$router.push({ 'path': '/setting-site' });
                } else {
                    _this3.$message.error(res.data.msg);
                }
            }).catch(function (res) {
                _this3.$message.error('请稍后重试2！');
            });
        },

        //服务器上传图片
        handleAvatarSuccess: function handleAvatarSuccess(res, file) {
            console.log(res);
            this.imageUrl = URL.createObjectURL(file.raw);
            if (res.code === 0) {
                this.$message.success(res.msg);
                this.path = res.path;
            } else {
                this.$message.err(res.msg);
            }
        },
        beforeAvatarUpload: function beforeAvatarUpload(file) {
            var isJPG = file.type === 'image/jpeg';
            var isLt2M = file.size / 1024 / 1024 < 2;

            if (!isJPG) {
                this.$message.error('上传头像图片只能是 JPG 格式!');
            }
            if (!isLt2M) {
                this.$message.error('上传头像图片大小不能超过 2MB!');
            }
            return isJPG && isLt2M;
        }
    }
});

/***/ }),

/***/ 241:
/***/ (function(module, exports, __webpack_require__) {

var render = function() {
  var _vm = this
  var _h = _vm.$createElement
  var _c = _vm._self._c || _h
  return _c(
    "div",
    { staticClass: "m-box" },
    [
      _c("hint", {
        attrs: { title: _vm.hint.title, content: _vm.hint.content }
      }),
      _vm._v(" "),
      _c("h2", [_vm._v("后台系统设置")]),
      _vm._v(" "),
      _c(
        "el-form",
        {
          ref: "ruleForm",
          staticClass: "demo-ruleForm",
          attrs: {
            model: _vm.ruleForm,
            rules: _vm.rules,
            "label-width": "300px"
          }
        },
        [
          _c(
            "el-form-item",
            { attrs: { label: "网站名称", prop: "name" } },
            [
              _c("el-input", {
                model: {
                  value: _vm.ruleForm.name,
                  callback: function($$v) {
                    _vm.$set(_vm.ruleForm, "name", $$v)
                  },
                  expression: "ruleForm.name"
                }
              })
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "el-form-item",
            { attrs: { label: "网站LOGO" } },
            [
              _c(
                "el-upload",
                {
                  staticClass: "avatar-uploader",
                  attrs: {
                    action: _vm.adminApi("upload-img/1"),
                    data: _vm.csrf_token,
                    "show-file-list": false,
                    "on-success": _vm.handleAvatarSuccess,
                    "before-upload": _vm.beforeAvatarUpload
                  }
                },
                [
                  _vm.imageUrl
                    ? _c("img", {
                        staticClass: "avatar",
                        attrs: { src: _vm.imageUrl }
                      })
                    : _c("i", {
                        staticClass: "el-icon-plus avatar-uploader-icon"
                      })
                ]
              )
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "el-form-item",
            { attrs: { label: "网站备案号", prop: "caseNumber" } },
            [
              _c("el-input", {
                model: {
                  value: _vm.ruleForm.caseNumber,
                  callback: function($$v) {
                    _vm.$set(_vm.ruleForm, "caseNumber", $$v)
                  },
                  expression: "ruleForm.caseNumber"
                }
              })
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "el-form-item",
            { attrs: { label: "联系人", prop: "linkman" } },
            [
              _c("el-input", {
                model: {
                  value: _vm.ruleForm.linkman,
                  callback: function($$v) {
                    _vm.$set(_vm.ruleForm, "linkman", $$v)
                  },
                  expression: "ruleForm.linkman"
                }
              })
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "el-form-item",
            { attrs: { label: "联系电话", prop: "tel" } },
            [
              _c("el-input", {
                model: {
                  value: _vm.ruleForm.tel,
                  callback: function($$v) {
                    _vm.$set(_vm.ruleForm, "tel", $$v)
                  },
                  expression: "ruleForm.tel"
                }
              })
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "el-form-item",
            { attrs: { label: "联系地址", prop: "address" } },
            [
              _c("el-input", {
                model: {
                  value: _vm.ruleForm.address,
                  callback: function($$v) {
                    _vm.$set(_vm.ruleForm, "address", $$v)
                  },
                  expression: "ruleForm.address"
                }
              })
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "el-form-item",
            { attrs: { label: "网站开关", prop: "openDown" } },
            [
              _c("el-switch", {
                model: {
                  value: _vm.ruleForm.openDown,
                  callback: function($$v) {
                    _vm.$set(_vm.ruleForm, "openDown", $$v)
                  },
                  expression: "ruleForm.openDown"
                }
              }),
              _vm._v(" "),
              _c("span", { staticClass: "c-danger" }, [
                _vm._v("网站关闭时文字必须填写")
              ])
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "el-form-item",
            { attrs: { label: "关闭网站文字显示", prop: "downDesc" } },
            [
              _c("el-input", {
                attrs: { type: "textarea" },
                model: {
                  value: _vm.ruleForm.downDesc,
                  callback: function($$v) {
                    _vm.$set(_vm.ruleForm, "downDesc", $$v)
                  },
                  expression: "ruleForm.downDesc"
                }
              })
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "el-form-item",
            [
              _c(
                "el-button",
                {
                  attrs: { type: "primary" },
                  on: {
                    click: function($event) {
                      _vm.submitForm("ruleForm")
                    }
                  }
                },
                [_vm._v("确认")]
              )
            ],
            1
          )
        ],
        1
      )
    ],
    1
  )
}
var staticRenderFns = []
render._withStripped = true
module.exports = { render: render, staticRenderFns: staticRenderFns }
if (false) {
  module.hot.accept()
  if (module.hot.data) {
    require("vue-loader/node_modules/vue-hot-reload-api")      .rerender("data-v-5a9376d0", module.exports)
  }
}

/***/ })

});